package com.gee.spring.boot.rpf.client.editor.nextclient.mblno;

import com.gee.spring.boot.rpf.client.editor.nextclient.AbstractNextClientEditor;
import com.gee.spring.boot.rpf.client.BaseClientResponse;
import com.gee.spring.boot.rpf.common.constant.SysConstant;
import com.gee.spring.boot.rpf.entity.ClientFlow;
import com.gee.spring.boot.rpf.util.client.ClientUtil;
import com.gee.thread.flow.common.result.ExecuteState;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * desc:
 *  根据手机号运营商 返回对应的 手机号在网时长接口
 * @author gee wrote on  2021-02-13 10:05:56
 */
@Component
public class OnlineTimeEditor extends AbstractNextClientEditor {

    @Resource
    private ClientUtil clientUtil;

    @Override
    public List<ClientFlow> getNextClientFlow(ExecuteState executeState, BaseClientResponse response, Object... otherParam) {
        if (otherParam == null || otherParam.length == 0 || otherParam[0] == null){
            return null;
        }
        String mblNoCarrier = otherParam[0].toString();
        if (SysConstant.MBLNO_CARRIER_CMCC.equals(mblNoCarrier)){
            return Collections.singletonList(clientUtil.getClientFlow(10L));
        }else if (SysConstant.MBLNO_CARRIER_CUCC.equals(mblNoCarrier)){
            return Collections.singletonList(clientUtil.getClientFlow(11L));
        }else if (SysConstant.MBLNO_CARRIER_CTCC.equals(mblNoCarrier)){
            return Collections.singletonList(clientUtil.getClientFlow(12L));
        }
        return null;
    }
}
